home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Cream of the Crop 3
/
Cream of the Crop 3.iso
/
clipper
/
ks94an.zip
/
__FOPEN.HDR
< prev
next >
Wrap
Text File
|
1994-04-25
|
3KB
|
126 lines
/******************************************************************************
The Klipper Library, for CA-Clipper 5.x
Copyright (c), 1994, Wallace Information Systems Engineering
FUNCTION:
_FOpen(cFileName, nMode) --> nHandle
PARAMETERS:
cFileName : File name to open/create
nMode : KFO_APPEND : Append to bottom of file
KFO_OVERWRITE: Overwrite at Beginning
KFO_TRUNC : Truncate to Zero Length and overwrite at beginning
SHORT:
OS File Open with optional file pointer placements.
DESCRIPTION:
_FOpen() opens/creates files and positions the file pointer according to
the directive in nMode. In any case, the specified file is created if it
does not exist.
_FOpen() Always opens for Read/Write.
_FOpen() returns the file handle of the opened/created file, or -1 if an
error occured. This can also be tested with FERROR() manually.
Return Codes:
-1 General File Error (DOS ERROR - Use FERROR() to Check)
-2 Unknown Error - your guess is as good as mine
-3 Either cFileName or nMode was not passed or was NIL
-4 Either nMode was not numeric or cFileName was not character
-5 nMode was out of range (USE KLIPPER.CH KFO_* directives!!!)
NOTE:
EXAMPLE:
Assuming that NEWFILE.TXT does not exist, all three of the following
are identical in operation:
_FOpen("NewFile.TXT",KFO_APPEND)
_FOpen("NewFile.TXT",KFO_OVERWRITE)
_FOpen("NewFile.TXT",KFO_TRUNC)
Now, assuming that DATAFILE.TXT exists and has data:
nHandle = _FOpen("DataFile.TXT",KFO_APPEND)
Appends any data written to nHandle (with standard clipper low level file
functions) to the bottom of the existing file.
DATAFILE.TXT CONTAINS:
<tof>
LINE111111111111111111111111111111
LINE222222222222222222222222222222
LINE333333333333333333333333333333
<eof>
nHandle = _FOpen("DATAFILE.TXT",KFO_APPEND)
fwrite(nhandle,"Yow!",4)
DATAFILE.TXT -NOW- CONTAINS:
<tof>
THIS IS OTHER DATA-TOO.11111111111
LINE222222222222222222222222222222
LINE333333333333333333333333333333Yow!
<eof>
_FOpen("DataFile.TXT",KFO_OVERWRITE)
Overwrites any data at the beginning of the file, for the length of the
data written, leaving data AFTER that point intact.
DATAFILE.TXT CONTAINS:
<tof>
LINE111111111111111111111111111111
LINE222222222222222222222222222222
LINE333333333333333333333333333333
<eof>
nHandle = _FOpen("DATAFILE.TXT",OVERWRITE)
fwrite(nhandle,"THIS IS OTHER DATA",18)
fwrite(nhandle,"-TOO.",4)
DATAFILE.TXT -NOW- CONTAINS:
<tof>
THIS IS OTHER DATA-TOO.11111111111
LINE222222222222222222222222222222
LINE333333333333333333333333333333
<eof>
_FOpen("DataFile.TXT",KFO_TRUNC)
DATAFILE.TXT CONTAINS:
<tof>
LINE111111111111111111111111111111
LINE222222222222222222222222222222
LINE333333333333333333333333333333
<eof>
nHandle = _FOpen("DATAFILE.TXT",KFO_TRUNC)
fwrite(nhandle,"THIS IS OTHER DATA",18)
DATAFILE -NOW- CONTAINS:
<tof>
THIS IS OTHER DATA
<eof>
******************************************************************************/